home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / Key.java < prev    next >
Text File  |  1998-09-22  |  3KB  |  101 lines

  1. /*
  2.  * @(#)Key.java    1.31 98/07/01
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security;
  16.  
  17. /**
  18.  * The Key interface is the top-level interface for all keys. It
  19.  * defines the functionality shared by all key objects. All keys
  20.  * have three characteristics:
  21.  * 
  22.  * <UL>
  23.  * 
  24.  * <LI>An Algorithm
  25.  * 
  26.  * <P>This is the key algorithm for that key. The key algorithm is usually
  27.  * an encryption or asymmetric operation algorithm (such as DSA or
  28.  * RSA), which will work with those algorithms and with related
  29.  * algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.)
  30.  * The name of the algorithm of a key is obtained using the 
  31.  * <a href = "#getAlgorithm">getAlgorithm</a> method.<P>
  32.  * 
  33.  * <LI>An Encoded Form
  34.  * 
  35.  * <P>This is an external encoded form for the key used when a standard
  36.  * representation of the key is needed outside the Java Virtual Machine,
  37.  * as when transmitting the key to some other party. The key
  38.  * is encoded according to a standard format (such as X.509
  39.  * or PKCS#8), and is returned using the 
  40.  * <a href = "#getEncoded">getEncoded</a> method.<P>
  41.  * 
  42.  * <LI>A Format
  43.  * 
  44.  * <P>This is the name of the format of the encoded key. It is returned 
  45.  * by the <a href = "#getFormat">getFormat</a> method.<P>
  46.  * 
  47.  * </UL>
  48.  * 
  49.  * Keys are generally obtained through key generators, certificates,
  50.  * or various Identity classes used to manage keys. There are no
  51.  * provisions in this release for the parsing of encoded keys and
  52.  * certificates.
  53.  *
  54.  * @see PublicKey
  55.  * @see PrivateKey
  56.  * @see KeyPair
  57.  * @see KeyPairGenerator
  58.  * @see Identity
  59.  * @see IdentityScope
  60.  * @see Signer
  61.  *
  62.  * @version 1.28, 97/01/29
  63.  * @author Benjamin Renaud 
  64.  */
  65.  
  66. public interface Key  extends java.io.Serializable {
  67.  
  68.     /**
  69.      * Returns the standard algorithm name this key is for. For
  70.      * example, "DSA" would indicate that this key is a DSA key. 
  71.      * Note that this method may return null, when the
  72.      * algorithm this key is for is unknown.
  73.      * 
  74.      * <p>See Appendix A in the <a href=
  75.      * "../guide/security/CryptoSpec.html#AppA">
  76.      * Java Cryptography Architecture API Specification & Reference </a> 
  77.      * for information about standard algorithm names.
  78.      * 
  79.      * @return the name of the algorithm this key is for, or null
  80.      * if the algorithm this key is for is unknown.  
  81.      */
  82.     public String getAlgorithm();
  83.  
  84.     /**
  85.      * Returns the format used to encode the key or null if the key does not
  86.      * support encoding.
  87.      * 
  88.      * @return the format used to encode the key.
  89.      */
  90.     public String getFormat();
  91.  
  92.     /**
  93.      * Returns the encoded key.
  94.      * 
  95.      * @return the encoded key, or null if the key does not support
  96.      * encoding.
  97.      *
  98.      */
  99.     public byte[] getEncoded();
  100. }
  101.